﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.AspNet.SignalR;
using Newtonsoft.Json;

namespace MoveShapeDemo
{
	public class MoveShapeHub : Hub
	{
		public void UpdateModel(ShapModel clientModel)
		{
			clientModel.LastUpdatedBy = Context.ConnectionId;
			Clients.AllExcept(clientModel.LastUpdatedBy).updateShape(clientModel);
		}

		public class ShapModel
		{
			[JsonProperty("left")]
			public double Left { get; set; }

			[JsonProperty("top")]
			public double Top { get; set; }

			// We don't want the client to get the "LastUpdatedBy" property
			[JsonIgnore]
			public string LastUpdatedBy { get; set; }
		}
	}		
}